package com.zjy.service;
import java.util.List;

//实现类也是自己写的
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zjy.dao.DepartmentMapper;
import com.zjy.pojo.Department;


@Service
public class DeptServiceImpl implements DeptService{

	//注入进来
	@Autowired
	DepartmentMapper departmentMapper;
	
	
	public DepartmentMapper getDepartmentMapper() {
		return departmentMapper;
	}


	public void setDepartmentMapper(DepartmentMapper departmentMapper) {
		this.departmentMapper = departmentMapper;
	}


	public int insert(Department dept) {
		// 想要实现数据的插入，要借助dao
		//调用接口的insert方法
		departmentMapper.insert(dept);//逆向工程自动生成的方法  不需要实现类
		System.out.println("====service===");
		return 1;
	}


	public List<Department> getDepts() {
		List<Department> list=departmentMapper.selectByExample(null);
		return list;
	}

}
